<template>
  <div :class="wrpCls">
    <!-- 右上角 (头像-姓名-下拉) -->
    <avatar-dropdown :menu="showMenu" :current-user="currentUser" :class="prefixCls" />
    <!-- 选择语言 -->
    <select-lang :class="prefixCls" :langInfo="langInfo" v-if="langInfo"/>
  </div>
</template>

<script>
import AvatarDropdown from './AvatarDropdown'
import SelectLang from '@/components/SelectLang'
import storage from 'store'
import { getInfo } from '@/api/data' 


export default {
  name: 'RightContent',
  components: {
    AvatarDropdown,
    SelectLang
  },
  props: {
    prefixCls: {
      type: String,
      default: 'ant-pro-global-header-index-action'
    },
    isMobile: {
      type: Boolean,
      default: () => false
    },
    topMenu: {
      type: Boolean,
      required: true
    },
    theme: {
      type: String,
      required: true
    }
  },
  data () {
    return {
      showMenu: true,
      currentUser: {},
      langInfo: '', 
    }
  },
  created(){
    // 获取登陆的语言信息
    this.getInfo();
  },



  methods:{
    
    
    async getInfo(){
      console.log("我进来了-123-")
      let responseData = await getInfo()
      this.langInfo = responseData

      console.log("现在出了大问题了, 测试一下数据-getInfo-", responseData);
      console.log("现在出了大问题了, 测试一下数据-langInfo-", this.langInfo);
    }


  },
  computed: {
    wrpCls () {
      return {
        'ant-pro-global-header-index-right': true,
        [`ant-pro-global-header-index-${(this.isMobile || !this.topMenu) ? 'light' : this.theme}`]: true
      }
    }
  },
  mounted () {

    

    console.log("-right-content-到此位置---");

    // 当前登陆用户名的获取显示处理
    setTimeout(() => {
      this.currentUser = {
        name: storage.get('userName')
      }
    }, 1500)
  }
}
</script>
